<template>
  <el-tag
    :type="type"
    effect="dark"
    class="order-status-tag"
  >
    {{text}}
  </el-tag>
</template>

<script>
export default {
  name: "OrderStatusTag",
  props:{
    orderStatus:{
      require: true,
    },
    ignore:{
      default : 0,
    },
    accountTypeNum:{
      default : 1,
    },
    orderIsSpecial:{
      default : false,
    },
  },
  watch: {
    orderStatus(){
      this.changeType()
    },
    ignore(){
      this.changeType()

    }
  },
  data(){
    return {
      text: '',
      type: '',
    }
  },
  created() {
    this.changeType()
  },
  methods:{
    changeType(){
      switch (this.orderStatus){
        case 1:
          this.type = 'untreated'
          this.text = this.$t('order.untreated')
          break;
        case 2:
          if (this.orderIsSpecial) {
            this.type = 'success'
            this.text = this.$t('order.processed')
            break;
          }
          this.type = 'send'
          this.text = this.$t('order.shipped')
          break;
        case 3:
          this.type = 'success'
          this.text = this.$t('order.completed')
          break;
        case 4:
          this.type = 'cancel'
          this.text = this.$t('order.canceled')
          break;
        case 5:
          this.type = 'cancel'
          this.text = this.$t('order.returned')
          break;
        case 6:
          this.type = 'warning'
          this.text = this.$t('order.waitPicked')
          break;
        case 7:
          this.type = 'success'
          this.text = this.$t('order.collectedItems')
          break;
        case 8:
          this.type = 'success'
          this.text = this.$t('order.inTransit')
          break;
        case 9:
          this.type = 'danger'
          this.text = this.$t('order.rejected')
          break;
        case 10:
          this.type = 'cancel'
          this.text = this.$t('order.lose')
          break;
      }
    }
  }
}
</script>

<style scoped lang="scss">
.order-status-tag{
  font-weight: bold;
}
</style>
